package test11To20;

import java.util.Scanner;

public class Test17 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String[] strs = s.split(";");

        Point point = new Point();
        for (String ss:strs){
            if ("".equals(ss)){
                continue;
            }
            if (ss.startsWith("A")){
                String a = ss.substring(1);
                boolean isNum = a.matches("[0-9]+");
                if (isNum){
                    point.x = point.x-Integer.parseInt(a);
                }
            }else if (ss.startsWith("D")){
                String a = ss.substring(1);
                boolean isNum = a.matches("[0-9]+");
                if (isNum){
                    point.x = point.x+Integer.parseInt(a);
                }
            }else if (ss.startsWith("W")){
                String a = ss.substring(1);
                boolean isNum = a.matches("[0-9]+");
                if (isNum){
                    point.y = point.y+Integer.parseInt(a);
                }
            }else if (ss.startsWith("S")){
                String a = ss.substring(1);
                boolean isNum = a.matches("[0-9]+");
                if (isNum){
                    point.y = point.y-Integer.parseInt(a);
                }
            }

        }
        System.out.println(point.x+","+ point.y);
    }

    static class Point{
        private int x=0;
        private int y=0;
    }
}
